package com.wangjw.concurrency.example.immutable;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.wangjw.concurrency.annotations.ThreadSafe;

/**
 * Created by wangjw on 18/4/30.
 */
@ThreadSafe
public class ImmutableExample3 {

    private static final ImmutableList list = ImmutableList.of(1, 2, 3);

    private static final ImmutableSet set = ImmutableSet.copyOf(list);

    private static final ImmutableMap<Integer, Integer> map1 = ImmutableMap.of(1, 2, 3, 4);

    private static final ImmutableMap<Integer, Integer> map2 = ImmutableMap.<Integer, Integer>builder()
            .put(1, 2)
            .put(3, 4)
            .build();

    public static void main(String[] args) {
        System.out.println(map2.get(3));
    }
}
